
import java.util.Arrays;
import edu.princeton.cs.algs4.*;


public class BinarySearch
{
    private BinarySearch() {}

    public static int indexOf(int[] a, int key)
    {
        int low = 0, high = a.length - 1;

        while(low <= high)
        {
            int mid = low + ((high - low) >> 1);

            if(a[mid] == key)
                return mid;
            else if(a[mid] > key)
                high = mid - 1;
            else 
                low = mid + 1;
        }

        return -1;
    }

    public static void main(String[] args)
    {
        In in  = new In(args[0]);
        int[] allowlist = in.readAllInts();

        Arrays.sort(allowlist);

        while(!StdIn.isEmpty())
        {
            int key = StdIn.readInt();

            if(BinarySearchs.indexOf(allowlist, key) == -1)
            {
                StdOut.println(key);
            }
            else
            {
                StdOut.println("find it!");
            }
        }
    }
}
